﻿/**********************************************************************
 * @file   GUIGroupDialog.h
 * @brief  可见性窗口管理
 * @author guqingtao (15598887859@163.com)
 * @date   2025-2-12
 *********************************************************************/
#ifndef _GUIGroupDialog_H
#define _GUIGroupDialog_H

#include "GUIToolDialogAPI.h"
#include "GUIWidget/GUIDialogBase.h"
#include "FITK_Interface/FITKInterfaceGeometry/FITKGeoCommandList.h"
#include "FITK_Component/FITKAcousticsModel/FITKAbstractSEASubSys.h"
#include "FITK_Component/FITKAcousticsModel/FITKAbstractFESubSys.h"
#include "FITK_Component/FITKAcousticsModel/FITKAbstractJunction.h"
#include "FITK_Component/FITKAcousticsPhysics/FITKAcousticsLoadManager.h"
#include "FITK_Component/FITKAcousticsModel/FITKAcousticsGroupData.h"
#include <QTreeWidget>
#include <QStack>

namespace Ui {
    class GUIGroupDialog;
}

namespace Core
{
    class FITKActionOperator;
}
namespace Acoustics 
{
    class FITKAcousticsGroupData;
}
namespace GUI
{
    /**
     * @brief  可见性窗口管理
     * @author guqingtao (15598887859@163.com)
     * @date   2024-2-12
     */
    class GUIToolDialogAPI GUIGroupDialog :public GUIDialogBase
    {
        Q_OBJECT;
    public:
        /**
         * @brief    构造函数
         * @author   guqingtao (15598887859@163.com)
         * @date     2024-2-12
         */
        GUIGroupDialog(Core::FITKActionOperator* oper, QWidget* parent = nullptr);
        /**
         * @brief    构造函数（修改数据）
         * @author   guqingtao (15598887859@163.com)
         * @date     2025-02-19
         */
        GUIGroupDialog(Core::FITKActionOperator* oper, int groupObjID, QWidget* parent = nullptr);
        /**
         * @brief    析构函数
         * @author   guqingtao (15598887859@163.com)
         * @date     2024-2-12
         */
        virtual ~GUIGroupDialog();
 
    private slots:
        ;
        /**
         * @brief    添加按钮点击事件
         * @author   guqingtao (15598887859@163.com)
         * @date     2024-2-12
         */
        void on_pushButton_Add_clicked();
        /**
         * @brief    移除按钮点击事件
         * @author   guqingtao (15598887859@163.com)
         * @date     2024-2-12
         */
        void on_pushButton_Remove_clicked();
        /**
         * @brief    确定按钮点击事件
         * @author   guqingtao (15598887859@163.com)
         * @date     2024-2-12
         */
        void on_pushButton_OK_clicked();
        /**
         * @brief    关闭按钮点击事件
         * @author   guqingtao (15598887859@163.com)
         * @date     2024-2-12
         */
        void on_pushButton_Cancel_clicked();    

    private:
        /**
        * @brief    初始化数据
        * @return   void
        * @author   guqingtao (15598887859@163.com)
        * @date     2024-2-12
        */
        void init();
        /**
         * @brief    初始化修改数据
         * @return   void
         * @author   guqingtao (15598887859@163.com)
         * @date     2025-02-19
         */
        void initRevise(int groupObjID);
        /**
         * @brief    根据数据信息查找TreeWidget节点
         * @return   QTreeWidgetItem *
         * @author   guqingtao (15598887859@163.com)
         * @date     2025-02-19
         */
        QTreeWidgetItem* findTreeWidgetItem(Acoustics::FITKAcousticsGroupData::AcousticsGroupDataType objType, int type, int objID);
        /**
         * @brief    递归查找TreeWidget节点
         * @return   QTreeWidgetItem *
         * @author   guqingtao (15598887859@163.com)
         * @date     2025-02-19
         */
        QTreeWidgetItem* findTreeWidgetItemRecursive(QTreeWidgetItem *parent, int dataObjType, int dataType, int dataObjId);
        /**
         * @brief    创建Geometry树节点及其子节点
         * @return   void
         * @author   guqingtao (15598887859@163.com)
         * @date     2024-2-13
         */
        void initGeometryTree(QTreeWidgetItem *parent);
        /**
         * @brief    创建Subsystem树节点及其子节点
         * @return   void
         * @author   guqingtao (15598887859@163.com)
         * @date     2024-2-13
         */
        void initSystemTree(QTreeWidgetItem *parent);
        /**
         * @brief    创建Junction树节点及其子节点
         * @return   void
         * @author   guqingtao (15598887859@163.com)
         * @date     2024-2-13
         */
        void initJunctionTree(QTreeWidgetItem *parent);
        /**
         * @brief    创建Load树节点及其子节点
         * @return   void
         * @author   guqingtao (15598887859@163.com)
         * @date     2024-2-13
         */
        void initLoadTree(QTreeWidgetItem *parent);
        /**
         * @brief    初始化图片
         * @return   void
         * @author   guqingtao (15598887859@163.com)
         * @date     2024-2-13
         */
        void initImage();
        /**
         * @brief    获取Geometry节点下的数据
         * @return   void
         * @author   guqingtao (15598887859@163.com)
         * @date     2024-2-14
         */
        void populateGeometryItems(QTreeWidgetItem *geometryItem, Interface::FITKGeoEnum::FITKGeometryComType type);
        /**
         * @brief    获取SEAsystem节点下的数据
         * @return   void
         * @author   guqingtao (15598887859@163.com)
         * @date     2024-2-14
         */
        void populateSEAItems(QTreeWidgetItem *geometryItem, Acoustics::FITKAbstractSEASubSys::SEASubSysType type);
        /**
         * @brief    获取FEsystem节点下的数据
         * @return   void
         * @author   guqingtao (15598887859@163.com)
         * @date     2024-2-14
         */
        void populateFEItems(QTreeWidgetItem *geometryItem, Acoustics::FITKAbstractFESubSys::FESubSysType type);
        /**
         * @brief    获取Junction节点下的数据
         * @return   void
         * @author   guqingtao (15598887859@163.com)
         * @date     2024-2-14
         */
        void populateJunctionItems(QTreeWidgetItem *geometryItem, Acoustics::FITKAbstractJunction::JunctionType type);
        /**
         * @brief    获取Load节点下的数据
         * @return   void
         * @author   guqingtao (15598887859@163.com)
         * @date     2024-2-14
         */
        void populateLoadItems(QTreeWidgetItem *geometryItem, Acoustics::FITKAcousticsAbstractLoad::AcousticsLoadType type);
    private:
        /**
         * @brief    ui
         * @author   guqingtao (15598887859@163.com)
         * @date     2024-2-12
         */
        Ui::GUIGroupDialog* _ui = nullptr;
        /**
         * @brief  判断构造函数标志位
         * @author guqingtao (15598887859@163.com)
         * @date   2025-02-19
         */
        int _groupObjID = 0;
    };
}
#endif
